package com.chinasoft.book.app;

import com.chinasoft.book.mapper.BookMapper;
import com.chinasoft.book.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BeanDIMain {

    public static void main(String[] args) {
        ApplicationContext ioc = new ClassPathXmlApplicationContext("bean_di.xml");

        // 取 setter 注入的bean
        BookService bookService = ioc.getBean("bookService", BookService.class);

        bookService.queryBook();

        System.out.println("------------------构造方法-------------------------");
        //  取构造方法注入的 bean
        BookService bookService2 = ioc.getBean("bookService2", BookService.class);

        bookService2.queryBook();
    }
}
